{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
    .form-group {
        margin-bottom: 15px;
    }
    .form-control {
        width: 100%;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        background-color: #fff;
        background-image: none;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
        transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
    }
    .layui-form-label {
        width: 120px;
    }
    .layui-input-block {
        margin-left: 140px;
        display: flex;
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .layui-input-inline {
        margin-right: 10px;
        width: 150px;
    }
</style>
{/block}

{block name="body"}
<div class="layui-form p-page">
    <h3 class="pb-3">添加进度</h3>
    
            <div class="layui-card-body">
                <form class="layui-form" lay-filter="progressForm">
                    <input type="hidden" name="case_id" value="{$case_id}">
            <div class="layui-form-item">
                <label class="layui-form-label">事件类型</label>
                <div class="layui-input-block">
                    <select name="event_type" lay-verify="required" lay-search>
                        <option value="">请选择事件类型</option>
                        <option value="材料收集">材料收集</option>
                        <option value="文书撰写">文书撰写</option>
                        <option value="立案提交">立案提交</option>
                        <option value="缴费完成">缴费完成</option>
                        <option value="调解程序">调解程序</option>
                        <option value="庭审通知">庭审通知</option>
                        <option value="判决生效">判决生效</option>
                        <option value="执行启动">执行启动</option>
                        <option value="终止委托">终止委托</option>
                    </select>
                </div>
            </div>
            
            <div class="layui-form-item">
                <label class="layui-form-label">发生日</label>
                <div class="layui-input-block">
                    <input type="text" name="event_time" id="event_time" lay-verify="required" placeholder="请选择事件日期" class="layui-input">
                </div>
            </div>
            
            <div class="layui-form-item">
                <label class="layui-form-label">内容描述</label>
                <div class="layui-input-block">
                    <textarea name="content" placeholder="请输入内容描述" class="layui-textarea"></textarea>
                </div>
            </div>
            

            
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formSubmit">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}

{block name="script"}
<script>
function gouguInit() {
// 确保 layui 库已加载
layui.use(['jquery', 'form', 'laydate', 'layer', 'tool'], function(){
    var layer = layui.layer;
    var form = layui.form;
    var laydate = layui.laydate;
    var $ = layui.jquery;
    var tool = layui.tool;
    
    // 日期选择器
    laydate.render({
        elem: '#event_time',
        type: 'date'
    });
    

    
    // 表单提交
    form.on('submit(formSubmit)', function(data){
        tool.post('{:url("lawcase/progress/add")}', data.field, function(res){
            if (res.code === 0) {
                layer.msg(res.msg || '添加成功', {icon: 1});
                if(parent && parent.loadProgressList) {
                    parent.loadProgressList(); // 刷新进度记录列表
                }
                tool.sideClose(1000); // 延迟1秒关闭
            } else {
                layer.msg(res.msg || '添加失败', {icon: 2});
            }
        });
        return false;
    });
});
}
</script>
{/block}